package main

import (
	"fmt"
	"io"
	"os"
)

func main() {
	file, err := os.OpenFile("/Users/dean/GoWorks/src/gomod/exercise/a.txt", os.O_RDWR, os.ModePerm)
	if err != nil {
		fmt.Println(err)
	}
	defer file.Close()

	//业务
	file.Seek(3, io.SeekStart)
	buf := []byte{1, 2, 3}
	file.Read(buf)
	fmt.Println(string(buf))

	file.Seek(2, io.SeekCurrent)
	file.Read(buf)
	fmt.Println(string(buf))

	file.Seek(0, io.SeekEnd)
	file.WriteString("dsads")

}
